<template>
	<view>
		<view class="pt24 pl24 pr24">

			<view class="wbg mb24 pl24 " style="overflow:hidden;border-radius:16upx;">
				<view class="touxiang pr10 relative">
					<image  
					 :src="details.avatar" 
						style="width: 116upx; height: 116upx;float: left; margin-top: 26upx; border-radius: 100upx;">
					</image>
					<view class="namelista">
						<view style="width: 100%;height: 50upx;margin-top:50upx;">
							<view style="float: left;">{{details.driver_name}}</view>
							<view style="float: left; color: #777; font-size: 23upx;"> {{details.plate_number}}</view>
							<view style="float: left; color: #777; font-size: 23upx;"> {{details.vehicle.title}}</view>
						</view>
						<view style="float: left; color: #FE7002;">
							<view class="grid">
								<view v-for="(item,index) in 5">
									<u-icon v-if="index==4" color="#D9D9D9" name="star-fill"></u-icon>
									<u-icon v-else color="#FD6901" name="star-fill"></u-icon>
								</view>
								{{details.service_mark}}分
							</view>

						</view>

					</view>

					<view @click="collect" class="tubshou absolute" style="top:56upx;right:10upx;">
						<!-- <u-icon name="star"></u-icon> -->
						<block v-if="details.star!=null">
							<u-icon color="#FD6901" name="star-fill"></u-icon>
							<view class="clled">已收藏</view>
						</block>
						<block v-else>
							<u-icon name="star-fill"></u-icon>
							<view class="clled">收藏</view>
						</block>
						
					</view>
				</view>

				<view style="width: 100%;overflow:hidden;" class="pt24 pb16">
					<view style="float: left;">
						<image src="../../static/now.png" style="width: 30upx; height: 40upx;float: left;"></image>
					</view>
					<view style="float: left; color: #777; font-size: 28upx;"> {{details.address}}</view>
				</view>
			</view>

			<view class="dindanlistab">
				<view class="ddnriong">
					<view style="font-size: 30upx;line-height: 82upx;">司机信息
					</view>
					<view class="pb30">
						<view class="mt24 over-hidden grid col-3 cu-title center-title">
							<view class="over-hidden relative">
								<view class="col333 fz48 bold">{{details.service_mark}}</view>
								<view class="col777 fz24 pt-24">用户评分</view>
							</view>
							<view class="over-hidden relative">
								<view class="col333 fz48 bold">2010</view>
								<view class="col777 fz24 pt-24 ">服务总里程</view>
							</view>
							<view class="over-hidden relative">
								<view class="col333 fz48 bold">{{details.service_number}}</view>
								<view class="col777 fz24 pt-24">服务订单数</view>
							</view>
						</view>

					</view>
				</view>
			</view>

			<view class="dindanlistab01">
				<view class="ddnriong">
					<view class="pt-32 fz32 col333">车辆信息</view>
					<view class="pt-32 pb24 col777 fz28">
						<view class="in-block mtitle">车辆分类</view>
						<text class="pl-12 col333">普发</text>
					</view>
					<view v-if="details.vehicle" class="pb24 col777 fz28">
						<view class="in-block mtitle">车型选择</view>
						<text class="pl-12 col333">{{details.vehicle.title}}</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">具体车型</view>
						<text class="pl-12 col333">五菱宏光</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">载重</view>
						<text class="pl-12 col333">{{details.vehicle.load_capacity}}吨</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">车厢长宽高</view>
						<text class="pl-12 col333">{{details.vehicle.title}}{{details.vehicle.length}}*{{details.vehicle.width}}*{{details.vehicle.height}}米（厢体）</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">载方</view>
						<text class="pl-12 col333">普发</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">车辆分类</view>
						<text class="pl-12 col333">2立方米</text>
					</view>
					<view class="pb24 col777 fz28">
						<view class="in-block mtitle">车辆照片</view>
						<view>
							<view v-for="(item,index) in details.car_image">
								<image :src="item"></image>
							</view>
						</view>
					</view>

				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				details: {},
				id: 1
			}
		},
		onLoad(e) {
			if (e.id) {
				this.id = e.id;
			}
		},
		onShow() {
			this.getData();
		},
		onReachBottom() {
			this.param.page++;
			if (this.param.page > this.last_page) {
				return;
			}
			this.getList();
		},
		methods: {
			getData() {
				this.$api['get']('user/view-driver', {
					driverid: this.id
				}).then(res => {
					if (res.code == 200) {
						this.details = res.data;
						if(res.data.driver_info.car_image){
							this.details.car_image=res.data.driver_info.car_image.split(",");
						}
					}
				});
			
			},
			collect() {
				var url='user/start-driver';
				if(this.details.star){
					url="user/cancel-collect";
				}
				this.$api['post'](url, {
					driverid: this.id
				}).then(res => {
					if (res.code == 200) {
					  this.$toast({title:"操作成功"});
					  this.getData();
					}
				});
			
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background-color: #F6F6F6
	}

	.mtitle {
		display: inline-block;
		width: 140upx;
	}

	.touxiang {
		width: 100%;

		float: left;
		background: #fff;
		border-radius: 16upx;
	}

	.namelista {
		width: 300upx;

		float: left;
		margin-left: 20upx;
	}

	.tubshou {
		width: 80upx;

		float: right;
		margin-left: 20upx;
	}

	.clled {
		width: 100%;
		height: 50upx;
		float: left;
		margin-top: 15upx;
		font-size: 24upx;
		color: #777;
	}

	.ttliaas {
		width: 100%;
		height: 82upx;
		float: left;
	}

	.ttlias {
		width: 100%;
		height: 82upx;
		float: left;
		border-bottom: 1upx solid#ccc;
	}

	.ddnriong {
		width: 90%;
		height: 100%;
		float: left;
		margin-left: 5%;
	}

	.dindanlistab {
		width: 96%;
		float: left;
		margin-top: 30upx;
		margin-left: 2%;
		border-radius: 16upx;
		background: #FFFFFF;
	}

	.dindanlistab01 {
		width: 96%;
	 
		float: left;
		margin-top: 30upx;
		margin-left: 2%;
		border-radius: 16upx;
		background: #FFFFFF;
	}
</style>